]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
switcherPopup: Move _createSwitcher implementations into constructors
authorRui Matos <tiagomatos@gmail.com>
Wed, 3 Sep 2014 15:15:31 +0000 (17:15 +0200)
committerRui Matos <tiagomatos@gmail.com>
Thu, 11 Sep 2014 17:12:17 +0000 (19:12 +0200)
We don't really need this step as a separate method since all
implementations are supposed to be created and shown immediately. This
also ensures that we have items to show in all subclasses.

https://bugzilla.gnome.org/show_bug.cgi?id=735976

js/ui/altTab.js
js/ui/ctrlAltTab.js
js/ui/status/keyboard.js
js/ui/switcherPopup.js

index efbb2382721b073b785a721fc5e1156b8a40d883..b11c4f13f1657cd5a85db3ea3584d1ae13a99d0f 100644 (file)
@@ -58,6 +58,14 @@ const AppSwitcherPopup = new Lang.Class({
         this._currentWindow = -1;
 
         this.thumbnailsVisible = false;
+
+        let apps = Shell.AppSystem.get_default().get_running ();
+
+        if (apps.length == 0)
+            return;
+
+        this._switcherList = new AppSwitcher(apps, this);
+        this._items = this._switcherList.icons;
     },
 
     _allocate: function (actor, box, flags) {
@@ -99,20 +107,6 @@ const AppSwitcherPopup = new Lang.Class({
         }
     },
 
-    _createSwitcher: function() {
-        let apps = Shell.AppSystem.get_default().get_running ();
-
-        if (apps.length == 0)
-            return false;
-
-        this._switcherList = new AppSwitcher(apps, this);
-        this._items = this._switcherList.icons;
-        if (this._items.length == 0)
-            return false;
-
-        return true;
-    },
-
     _initialSelection: function(backward, binding) {
         if (binding == 'switch-group') {
             if (backward) {
@@ -365,30 +359,23 @@ const WindowSwitcherPopup = new Lang.Class({
     Name: 'WindowSwitcherPopup',
     Extends: SwitcherPopup.SwitcherPopup,
 
-    _init: function(items) {
-        this.parent(items);
+    _init: function() {
+        this.parent();
         this._settings = new Gio.Settings({ schema_id: 'org.gnome.shell.window-switcher' });
-    },
 
-    _getWindowList: function() {
-        let workspace = this._settings.get_boolean('current-workspace-only') ? global.screen.get_active_workspace() : null;
-        return global.display.get_tab_list(Meta.TabList.NORMAL, workspace);
-    },
-
-    _createSwitcher: function() {
         let windows = this._getWindowList();
 
         if (windows.length == 0)
-            return false;
+            return;
 
         let mode = this._settings.get_enum('app-icon-mode');
         this._switcherList = new WindowList(windows, mode);
         this._items = this._switcherList.icons;
+    },
 
-        if (this._items.length == 0)
-            return false;
-
-        return true;
+    _getWindowList: function() {
+        let workspace = this._settings.get_boolean('current-workspace-only') ? global.screen.get_active_workspace() : null;
+        return global.display.get_tab_list(Meta.TabList.NORMAL, workspace);
     },
 
     _initialSelection: function(backward, binding) {
index fc884ae170c70a2d083fd05559fa1dcc6ec59b97..85e39dfbc7a099c4c0d1089c7aef018bb4f8b379 100644 (file)
@@ -140,9 +140,10 @@ const CtrlAltTabPopup = new Lang.Class({
     Name: 'CtrlAltTabPopup',
     Extends: SwitcherPopup.SwitcherPopup,
 
-    _createSwitcher: function() {
+    _init: function(items) {
+        this.parent(items);
+
         this._switcherList = new CtrlAltTabSwitcher(this._items);
-        return true;
     },
 
     _initialSelection: function(backward, binding) {
index 888995999b5c83f4fae63125badee238e6583fde..ea02f6f8fd3a46ad47e1d3d50d62a46df3ad6f6e 100644 (file)
@@ -265,11 +265,8 @@ const InputSourcePopup = new Lang.Class({
 
         this._action = action;
         this._actionBackward = actionBackward;
-    },
 
-    _createSwitcher: function() {
         this._switcherList = new InputSourceSwitcher(this._items);
-        return true;
     },
 
     _initialSelection: function(backward, binding) {
index ccb774de33f016e20df81e17c23fdc12739f579c..c9d3884b947899b15456f139fc0f21123eeb1644 100644 (file)
@@ -102,16 +102,12 @@ const SwitcherPopup = new Lang.Class({
         this._switcherList.actor.allocate(childBox, flags);
     },
 
-    _createSwitcher: function() {
-        throw new Error('Not implemented');
-    },
-
     _initialSelection: function(backward, binding) {
         throw new Error('Not implemented');
     },
 
     show: function(backward, binding, mask) {
-        if (!this._createSwitcher())
+        if (this._items.length == 0)
             return false;
 
         if (!Main.pushModal(this.actor)) {